let resizeHandlers = []
window.addEventListener('resize', () => {
  resizeHandlers.forEach(item => item.cb.call(item.dom, item.dom))
})

export const addListener = function (ele, handler) {
  resizeHandlers.push({
    dom: ele,
    cb: handler
  })
}

export const removeListener = function (ele, handler) {
  resizeHandlers = resizeHandlers.filter(t => t.dom !== ele && t.cb !== handler)
}
